package com.sentrix.auto.printercenter.infrastructure.agentserver.dto;

import com.sentrix.auto.printercenter.common.IdGenerator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;

/**
 * eg:
 * {
 *     "call": "print",
 *     "params": {
 *         "printer": {
 *             "name": "UNIV on MFP14328078"
 *         },
 *         "options": {
 *             "bounds": null,
 *             "colorType": "color",
 *             "copies": 1,
 *             "density": 0,
 *             "duplex": false,
 *             "fallbackDensity": null,
 *             "interpolation": "bicubic",
 *             "jobName": null,
 *             "legacy": false,
 *             "margins": 0,
 *             "orientation": null,
 *             "paperThickness": null,
 *             "printerTray": null,
 *             "rasterize": false,
 *             "rotation": 0,
 *             "scaleContent": true,
 *             "size": null,
 *             "units": "in",
 *             "forceRaw": false,
 *             "encoding": null,
 *             "spool": {
 *
 *             }
 *         },
 *         "data": [
 *             {
 *                 "type": "pixel",
 *                 "format": "pdf",
 *                 "flavor": "file",
 *                 "data": "file:\/\/\/C:\/Program%20Files\/QZ%20Tray\/demo\/assets\/pdf_sample.pdf",
 *                 "options": {
 *                     "pageWidth": "",
 *                     "pageHeight": "",
 *                     "pageRanges": "",
 *                     "ignoreTransparency": false,
 *                     "altFontRendering": false
 *                 }
 *             }
 *         ]
 *     },
 *     "signature": "",
 *     "timestamp": 1758523089489,
 *     "uid": "qsyr93",
 *     "position": {
 *         "x": 1280,
 *         "y": 700
 *     },
 *     "signAlgorithm": "SHA512"
 * }
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class BaseQZPrintReq<T> extends Uid {

    private CallMethodType call;
    private T params;
    private String signature;
    private long timestamp ;
    private PrintPosition position;
    private String signAlgorithm;

    public BaseQZPrintReq(){
        this(IdGenerator.generateId());
    }

    public BaseQZPrintReq(String uid) {
        super(uid);
        this.timestamp = System.currentTimeMillis();
    }

    public static class PrintPosition {
        private int x;
        private int y;
    }



    @JsonProperty("call")
    public String call() {
        return call.methodName();
    }
}
